!lm10
!rm76
Hi-Res SCRN Function for Applesoft

Apple's Lo-Res graphics capability includes a SCRN(X,Y) function, to determine the color currently on the screen at the given X,Y point.  For some reason they did not provide the corresponding HSCRN(X,Y) function for Hi-Res graphics.

The following program implements the HSCRN function using the "&" character.  If you write the statement "& HSCRN (A=X,Y)", this program will store either a 1 or a 0 into the variable A.  The value 0 will be stored in A if there is not a spot plotted at X,Y; the value 1 will be stored if there is a spot.

Note that HPLOT(X,Y) may not result in a spot being plotted at X,Y; it depends on the HCOLOR you have set.  If the HCOLOR is white, a spot will always be plotted; if it is black, a spot will always be erased; the other four colors may or may not plot a spot, depending on position and color.

The &HSCRN statement does not return the actual color, because that is MUCH more difficult to determine.  The actual color depends on: whether the adjacent spots are on or off; whether X,Y is in an even or odd byte; whether X,Y is in an even or odd bit; and whether the sign bit of the byte is on or off.  If you decide to add the capability to return a color value (0-7), send me a copy for this newsletter!
